package utils

import (
	"github.com/gin-gonic/gin"
	"github.com/star-find-cloud/star-chat/conf"
)

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	HostID  int32  `json:"host_id"`
}

func RespondError(c *gin.Context, status int, message string) {
	var config = conf.GetConfig()
	c.AbortWithStatusJSON(status, ResponseError{
		Code:    status,
		Message: message,
		HostID:  config.App.NodeID,
	})
}
